{template 'web/common/common'}
{template 'web/distribution/navbar'}
<link rel="stylesheet" type="text/css" href="../addons/{php echo $_GPC['m']}/resource/swal/dist/sweetalert2.min.css" />
<link rel="stylesheet" type="text/css" href="../addons/kundian_farm/resource/css/layui.css" />
<link rel="stylesheet" type="text/css" href="../addons/kundian_farm/resource/css/new-common.css" />
<blockquote class="layui-elem-quote">
    分销提现
</blockquote>
<div class="layui-form">
    <table class="layui-table">
        <thead>
        <tr>
            <th>用户UID</th>
            <th>头像</th>
            <th>用户昵称</th>
            <th>姓名</th>
            <th>提现金额</th>
            <th>打款账号</th>
            <th>状态</th>
            <th>申请时间</th>
            <th>备注</th>
            <th>操作</th>
        </tr>
        </thead>
        <tbody>
        {loop $list $key $item}
        <tr>
            <td>{$item['uid']}</td>
            <td><img src="{$item['avatarurl']}" style="width: 40px;height: 40px;" alt=""></td>
            <td>{$item['nickname']}</td>
            <td>{$item['name']}</td>
            <td>{$item['price']}元</td>
            <td>{$item['wx_account']}</td>
            <td>
                {if $item['status']==0}
                <span class="layui-badge layui-bg-gray">待审核</span>
                {else if $item['status']==1}
                <span class="layui-badge layui-bg-green">已打款</span>
                {else if $item['status']==2}
                <span class="layui-badge layui-bg-orange">已拒绝</span>
                {/if}
            </td>
            <td><?php echo date("Y-m-d H:i:s",$item['create_time']);?></td>
            <td>{$item['remark']}</td>
            <td>
                {if $item['status']==0}
                <button class="layui-btn layui-btn-sm agreeWithdraw" data-id="{$item['id']}">打款</button>
                <a href="{url 'site/entry/distribution',array('m'=>'kundian_farm','id'=>$item['id'],'op'=>'deny_withdraw','version_id'=>$_GPC['version_id'])}">
                    <button class="layui-btn layui-btn-sm layui-btn-danger">拒绝</button>
                </a>
                {else}
                --
                {/if}
            </td>
        </tr>
        {/loop}
        </tbody>
    </table>
    <div style="text-align: right;">
        {$pager}
    </div>
</div>

<script>
    require(["../addons/{php echo $_GPC['m']}/resource/swal/dist/sweetalert2.min.js"],function(){
        $(function(){
            //同意
            $(".agreeWithdraw").click(function(){
                var that=$(this);
                var id=$(this).attr('data-id');
                swal({
                    title: '提示',
                    text: '确认已经打款了吗？',
                    type: 'warning',
                    showCancelButton: true,
                    confirmButtonColor: '#3085d6',
                    cancelButtonColor: '#d33',
                    confirmButtonText: '确认',
                    cancelButtonText: '取消',
                }).then(function(isConfirm) {
                    if (isConfirm) {
                        $.ajax({
                            type:"post",
                            url:"{url 'site/entry/'.$_GPC['do'],array('m'=>$_GPC['m'],'op'=>'agreeWithdraw','version_id'=>$_GPC['version_id'])}",
                            data:{id:id},
                            dataType:'json',
                            success:function(res){
                                if(res.status==1){
                                    swal('操作成功!', '操作成功!', 'success');
                                }else{
                                    swal('操作失败!', '操作失败!', 'error');
                                }
                            }
                        })
                    }
                })
            });
        })

    })
</script>


